/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TemplateFilesPanel.java
 *
 * Created on 2010-1-18, 11:35:57
 */
package org.netbeans.modules.web.click.actions;

import java.awt.Dimension;
import javax.swing.Box;
import javax.swing.ListSelectionModel;

/**
 *
 * @author hantsy
 */
public class TemplateSelectionPanel extends javax.swing.JPanel {

    /** Creates new form TemplateFilesPanel */
    private String[] templatePaths = null;

    public TemplateSelectionPanel(String[] templatePahts) {     
        this.templatePaths = templatePahts;
        initComponents();
        jList1.setSelectedIndex(0);
        jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList(templatePaths);

        setMinimumSize(new java.awt.Dimension(250, 165));
        setPreferredSize(new java.awt.Dimension(250, 165));
        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.Y_AXIS));

        jLabel1.setText(org.openide.util.NbBundle.getMessage(TemplateSelectionPanel.class, "TemplateSelectionPanel.jLabel1.text")); // NOI18N
        jLabel1.setAlignmentX(0.5f);
        jLabel1.setFocusable(false);
        add(jLabel1);

        jScrollPane1.setViewportView(jList1);

        add(Box.createRigidArea(new Dimension(0,15)));

        add(jScrollPane1);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

    public int getSelectionIndex() {
        return jList1.getSelectedIndex();
    }
}
